Skip to contents

First choose a zone of interest

For the example we will work with the Camors forest. First of all we need the commune border that can be obtained with get_apicarto_commune from the insee code. For convenience, happign provides a table containing all insee codes (data("cog_2023")).

data("cog_2023")

#search communes name Camors and extract insee code
insee_code <- cog_2023[grepl("^Camors", cog_2023$LIBELLE),"COM"]

camors_border <- get_apicarto_cadastre(insee_code, type = "commune")
#> ⠙ Iterating 1 done (0.069/s) | 14.4s
#> Iterating ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s

tm_shape(camors_border)+
   tm_borders()+
   tm_text("nom_com")

An other way of getting borders without Apicarto is to use ECQL language to directly query IGN WFS geoservers.

camors_border2 <- get_wfs(
   layer = "ADMINEXPRESS-COG-CARTO.LATEST:commune",
   ecql_filter = "nom_m LIKE 'CAMORS'"
   )
#> Features downloaded : 1

# "nom_m" attribut can be found using get_wfs_attributes(layer)

Download cadastral parcel

Cadastral parcels are essential for any forest manager. Here how to download it with get_wfs.

layers <- get_layers_metadata("wfs", "parcellaire")
parcellaire_layer <- layers[15,1] # "CADASTRALPARCELS.PARCELLAIRE_EXPRESS:parcelle"

camors_parcels <- get_wfs(
   x = camors_border,
   spatial_filter = "intersects",
   layer = parcellaire_layer)
#> Features downloaded : 1000...2000...3000...3605

tm_shape(camors_border)+
   tm_borders(col = "red", lwd = 2)+
tm_shape(camors_parcels)+
   tm_polygons(fill_alpha = 0)
#> Registered S3 method overwritten by 'jsonify':
#>   method     from    
#>   print.json jsonlite